<html>
<body>
<p>This test expects a HTTP fetch resulting in a redirect for the first history
navigation. This doesn't happen if the page is restored from back-forward cache,
so back-fowrad cache has to be disabled to test this behaviour.
</p>

<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

window.onload = function() {
    if (location.hash == "#back") {
        document.body.appendChild(document.createTextNode("We pass if we don't crash."));
        if (window.testRunner)
            testRunner.notifyDone();
        return;
    }

    setTimeout(function() {
        history.replaceState({}, "", "#back");
        history.pushState({}, "", "http://127.0.0.1:8000/resources/redirect.php?url=http://localhost:8000/history/resources/back.html");
        location = "http://127.0.0.1:8000/history/resources/back.html";
    }, 0);
};
</script>
</body>
</html>
